<%@page import="uiux4.BeanSum" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC >
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>beanSum.jsp</title>
	<style>
		#result
		{
			border: 5px dotted #aaa;
			width:94%;
			padding:20px;
			border-radius:10px;
			overflow:auto;
		}
	</style>
</head>
<body>
<%
	int num1=0;
	int num2=0;
	BeanSum s = new BeanSum();
	int sum=0;
	if(request.getMethod().equals("POST"))
	{
		try
		{
			num1 = Integer.parseInt(request.getParameter("num1"));
			num2 = Integer.parseInt(request.getParameter("num2"));
			
			sum = s.Sum(num1, num2);
		}
		catch(Exception ex)
		{
			%>
			<script>
				alert("숫자를 입력하여 주세요");
			</script>
			<%
		}
	}
%>
	<div class=title>JavaBean Gugudan(2)</div>
	<form name='sum_form' method='post' id='sum_form' action='main.jsp?inc=./jsp/beanSum.jsp'>
		<label>Sum</label>
		<input type=text size=3 name='num1' id='num1'>
		~
		<input type=text size=3 name='num2' id='num2'>
		<input type=submit value='su~m' id='okBtn'>
	</form>
	<div id='result'>
		<%if(num1!=0 && num2!=0)
		{
		%>
			<%=num1 %> 부터 <%=num2 %>까지의 합계는  : <%=sum%> 입니다.
		<%
		}
		else
		{
		%>
			숫자를 입력하여 주세요 ~_~
		<%
		}
		%>
	</div>
</body>
</html>